﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;

namespace DataLayer
{
    public class dlteams
    {
        public DataSet TeamList()
        {
            string connStr = ConfigurationManager.ConnectionStrings["constring"].ConnectionString;
            string querystring = @"select * from Teams inner join TeamUser on Teams.TeamID = TeamUser.TeamId";

            SqlConnection connection = new SqlConnection(connStr);
            SqlCommand querylogin = new SqlCommand(querystring, connection);

            SqlDataAdapter myadapter = new SqlDataAdapter(querylogin);
            DataSet mydataset = new DataSet();

            myadapter.Fill(mydataset);

            return mydataset;
        }

        public DataSet TeamList(string team)
        {
            string connStr = ConfigurationManager.ConnectionStrings["constring"].ConnectionString;
            string querystring = @"select * from Teams where TeamID = "+team+"";

            SqlConnection connection = new SqlConnection(connStr);
            SqlCommand querylogin = new SqlCommand(querystring, connection);

            SqlDataAdapter myadapter = new SqlDataAdapter(querylogin);
            DataSet mydataset = new DataSet();

            myadapter.Fill(mydataset);

            return mydataset;
        }
    }
}
